import axios from 'axios'
import Vue from 'vue'
axios.interceptors.request.use(config => {
    // console.log(config);
    config.headers.token =  window.sessionStorage.getItem("token")
    return config;
})
export default {
  namespaced:true,
  state:{
    loading:true,
    datalist: [],
    datalistRootId:'',
    updateDataList : {},
    newtCatlog:{},
    deleteCatelogId:'',
    theVectorData: [],
    oldVectorData :[],
    theVectorDataTotal:0,
    documentIdList:[],
    vectorDataFindKeys:new Array(3),
    currentLink:"/theVector",
    resetTextBreadCrumbsList:[],
    resetVectorBreadCrumbsList:[],
    catalogList:[],
    TheBackupListTable:[],
    dataType:true,
    catalogListSelect:[],
    backupList:[],
    backupListTotal:0,
    ontimeBackupSingleText:'',
    xlsname:'',
    dbasenamelist:[],
    dbtablenamelist:[],
    dbtablenamelistObj:[],
    backupRecoveryList:[],
    backupConfigTotalCounts:0,
    backUpConfigMes:'',
    figureNumbers:[],
    figureAreas:[],
    figureLines:[],
    groupData:[],
    groupAtomsData:[],
    groupHjzldxData:[],
    groupZylysxData:[],
    groupHjgkdyData:[],


    divisionsFigureNumbers:[],
    divisionsFigureAreas:[],
    divisionsFigureLines:[],

    DivisionsAtomsAreaList:[],
    DivisionsHjzldxAreaList:[],
    DivisionsZylysxAreaList:[],
    DivisionsHjgkdyAreaList:[],

    currentCatalogId:'',
    currentPageNumber:1,

    groupTotalAreas:[],
    groupTotalCount:[],

    divisionCount:[],
    theAllCount:0,
    theAllArea:0,

    theTotalNumberOfDeclaration:'',
    currentTime:'',

    textAchievementsInfos:[],
    textAchievementsInfosTotal:0,

    textAchievementsInfosSuccess:[],
    textAchievementsInfosTotalSuccess:0,

    textAchievementsInfosAll:[],
    textAchievementsInfosTotalAll:0,

    vectorFileCategoryList:[],

    textDataInfo:[],
    textDataInfoTotal:0,

    downloadXlsDataInfos:[],

    theDYVectorData : [],
    theDYVectorDataTotal : 0,

    options:[],

    DownloadTextDataInfos:[],
  },
  getters:{


    theOptions:state => state.options,
    catlogRootId:(state)=>state.datalist.length,
    datas:(state)=>state.datalist,
    catalogOptions:(state)=>state.catalogListSelect,
    loadingState:(state)=>state.loading,
    VectorData:function(state){
      return state.theVectorData
    },
    backListTable:(state)=>state.backupList,
    vectorDataTotal:(state)=>state.theVectorDataTotal,
    documentIdLists:(state)=>state.documentIdList,
    link:(state)=>state.currentLink,
    resetTextBreadCrumbsList:(state)=>state.resetTextBreadCrumbsList,
    resetVectorBreadCrumbsList:(state)=>state.resetVectorBreadCrumbsList,
    catalogLists:(state)=>(state.catalogList),
    TheBackupListTables:(state)=>(state.TheBackupListTable),
    dataType:(state)=>(state.dataType),
    backupListTotalCounts:(state)=>state.backupListTotal,
    ontimeBackupSingle:(state)=>state.ontimeBackupSingleText,
    xls_name:(state)=>state.xlsname,
    // txtxlsname:state =>state.Txtxlsname,
    dbBaseNameList:(state)=>state.dbasenamelist,
    dbTablenNameList: (state)=>state.dbtablenamelist,
    dbTablenNameListObj:(state)=>state.dbtablenamelist,
    dbtablenameObj:(state)=>state.dbtablenamelistObj,
    backupRecovery:(state)=>state.backupRecoveryList,
    backupConfigTotalCount:(state)=>state.backupConfigTotalCounts,
    backUpConfigMessage:(state)=>state.backUpConfigMes,
    figureNumberList:(state)=>state.figureNumbers,
    figureArea:(state)=>state.figureAreas,
    figureLine:(state)=>state.figureLines,
    groupDatas:(state)=>state.groupData,
    groupAtomsDatas:(state)  =>state.groupAtomsData,
    groupHjzldxDatas:(state) =>state.groupHjzldxData,
    groupZylysxDatas:(state) =>state.groupZylysxData,
    groupHjgkdyDatas:(state) =>state.groupHjgkdyData,

    divisionsFigureNumber:(state) =>state.divisionsFigureNumbers,
    divisionsFigureArea:(state) =>state.divisionsFigureAreas,
    divisionsFigureLine:(state) =>state.divisionsFigureLines,
    divisionsAtomArea:(state) => state.DivisionsAtomsAreaList,
    divisionsHjzldxArea:(state) => state.DivisionsHjzldxAreaList,
    divisionsZylysxArea:(state) => state.DivisionsZylysxAreaList,
    divisionsHjgkdyArea:(state) => state.DivisionsHjgkdyAreaList,

    theCurrentCatalogId:(state) =>state.currentCatalogId,
    theCurrentPageNumber:(state) => state.currentPageNumber,

    theGroupTotalArea:(state)=> state.groupTotalAreas,
    theGroupTotalCount:(state)=> state.groupTotalCount,

    theDivisionCount:(state)=> state.divisionCount,

    theAllCounts:(state) =>state.theAllCount,
    theAllAreas:(state) =>state.theAllArea,

    theTotalNumberOfDeclarations:(state)=>state.theTotalNumberOfDeclaration,
    theCurrentTime:(state)=>state.currentTime,

    theTextAchievementsInfos:(state)=>state.textAchievementsInfos,
    theTextAchievementsInfosTotal:(state)=>state.textAchievementsInfosTotal,

    theTextAchievementsInfosSuccess:(state)=>state.textAchievementsInfosSuccess,
    theTextAchievementsInfosTotalSuccess:(state)=>state.textAchievementsInfosTotalSuccess,

    theTextAchievementsInfosAll:(state)=>state.textAchievementsInfosAll,
    theTextAchievementsInfosTotalAll:(state)=>state.textAchievementsInfosTotalAll,

    theVectorFileCategoryList:(state)=>state.vectorFileCategoryList,

    theTextDataInfo:(state)=>state.textDataInfo,
    theTextDataInfoTotal:(state)=>state.textDataInfoTotal,

    theDownloadXlsDataInfos:(state)=>state.downloadXlsDataInfos,

    theDyVectorData :(state) =>state.theDYVectorData,
    theDyVectorDataTotal:(state)=>state.theDYVectorDataTotal,

    theDownloadTextDataInfos:state=>state.DownloadTextDataInfos
  },
  mutations:{
    getCityByDivision(state,payload){
      state.options = []
      if (payload!== null){
        if (payload.length>1){
          var data = payload
          var data1 = data.slice(0,data.length-1)
          var data2 = data.slice(-1)
          var newData = data2.concat(data1)

          state.options = newData

        }
        else{
          state.options = payload
        }

      }

    },
    getDownloadTextDataInfo(state,payload){
      state.DownloadTextDataInfos = []
      if (payload !== null){
        var result = payload.result
        for(var i =0 ;i<result.length;i++){
          result[i]['id'] = i + 1
          state.DownloadTextDataInfos.push(result[i])
        }
      }
      else{
        state.DownloadTextDataInfos = []
      }
    },
    downloadXlsData(state,payload){
      state.downloadXlsDataInfos = []
      if (payload !== null){
        var result = payload.result
        for(var i =0 ;i<result.length;i++){
           result[i]['ids'] = i + 1
           state.downloadXlsDataInfos.push(result[i])
        }
      }
      else{
        state.downloadXlsDataInfos = []
      }
    },
    getTextDataInfo(state,payload){
       if (payload.data!==null){
           if (payload.data.hasOwnProperty('result')){
              state.textDataInfo = payload.data.result
              for (var i=0;i<state.textDataInfo.length;i++){
                 state.textDataInfo[i]['ids'] = i + 1 + (payload.pageNumber-1)*(payload.pageSize)
              }
           }
           else{
             state.textDataInfo = []
           }
           state.textDataInfoTotal = payload.data.totalCount
       }
       else{
         state.textDataInfo = []
         state.textDataInfoTotal = 0
       }

    },
    getVectorFileCategoryList(state,payload){
        state.vectorFileCategoryList = payload
    },
    getDivisionTextAchievements(state,payload){
       var specificList = ['xls','xlsx','cpg','shp','shx','prj','dbf']
       if (payload.data !== null){
         if (payload.data.hasOwnProperty('result')){
           var textAchievementsInfo =  payload.data.result
           for(var i = 0;i<textAchievementsInfo.length;i++){
             var evidence = []
             textAchievementsInfo[i]['listing'] = " "

             if (textAchievementsInfo[i].hasOwnProperty('files')){
               var files = textAchievementsInfo[i].files
               for (var j =0;j<files.length;j++){
                 if (files[j].fileName.indexOf('shp')!==-1){
                   textAchievementsInfo[i]['fileName'] = files[j].fileName
                 }
                 if (files[j].fileType ==='xls' || files[j].fileType ==='xlsx'){
                   textAchievementsInfo[i]['listing'] = files[j].fileName
                 }
                 else{
                   textAchievementsInfo[i]['listing'] = textAchievementsInfo[i]['listing'] +  ''
                 }
                 if (specificList.indexOf(files[j].fileType) === -1 && files[j].isHistory !==1){
                    evidence.push(files[j].fileName)
                 }

               }
             }
             if (textAchievementsInfo[i].isApproved === 2){
               textAchievementsInfo[i]['isApproved2'] = "人工审核中"
             }
             if (textAchievementsInfo[i].verifyType === 0){
               textAchievementsInfo[i]['verifyType2'] = "系统审核"
             }
             else {
               textAchievementsInfo[i]['verifyType2'] = "人工审核"
             }
             var date = textAchievementsInfo[i].uploadDate
             var dateee = new Date(date).toJSON();

             var newDate = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
             textAchievementsInfo[i]['uploadDate2'] = newDate
             textAchievementsInfo[i]['ID'] = (payload.pageNumber-1)*(payload.pageSize) + 1 + i
             if (evidence.length>0){
               var evidenceString = ""
               for (var m =0;m<evidence.length;m++){
                   var num = m + 1
                   evidenceString = evidenceString + " \n  " + '(' + num + ')' + '、' + evidence[m]
               }
               textAchievementsInfo[i]['evidence'] = evidenceString
             }
             else{
               textAchievementsInfo[i]['evidence'] = " "
             }

           }
         }
         state.textAchievementsInfos = textAchievementsInfo
         state.textAchievementsInfosTotal = payload.data.totalCount
       }
       else{
         state.textAchievementsInfos = []
         state.textAchievementsInfosTotal = 0
       }
    },
    getDivisionTextAchievementsAll(state,payload) {
      var specificList = ['xls','xlsx','cpg','shp','shx','prj','dbf']
      if (payload.data !== null){
        if (payload.data.hasOwnProperty('result')){
          var textAchievementsInfo =  payload.data.result
          for(var i = 0;i<textAchievementsInfo.length;i++){
            var evidence = []
            textAchievementsInfo[i]['listing'] = " "

            if (textAchievementsInfo[i].hasOwnProperty('files')){
              var files = textAchievementsInfo[i].files
              for (var j =0;j<files.length;j++){
                if (files[j].fileName.indexOf('shp')!==-1){
                  textAchievementsInfo[i]['fileName'] = files[j].fileName
                }
                if (files[j].fileType ==='xls' || files[j].fileType ==='xlsx'){
                  textAchievementsInfo[i]['listing'] = files[j].fileName
                }
                else{
                  textAchievementsInfo[i]['listing'] = textAchievementsInfo[i]['listing'] +  ''
                }
                if (specificList.indexOf(files[j].fileType) === -1){
                  evidence.push(files[j].fileName)
                }

              }
            }
            if (textAchievementsInfo[i].isApproved === 2){
              textAchievementsInfo[i]['isApproved2'] = "人工审核中"
            }
            else if (textAchievementsInfo[i].isApproved === 1){
              textAchievementsInfo[i]['isApproved2'] = "审核完成"
            }
            else {
              textAchievementsInfo[i]['isApproved2'] = "重新上传"
            }
            if (textAchievementsInfo[i].verifyType === 0){
              textAchievementsInfo[i]['verifyType2'] = "系统审核"
            }
            else {
              textAchievementsInfo[i]['verifyType2'] = "人工审核"
            }
            var date = textAchievementsInfo[i].uploadDate
            var dateee = new Date(date).toJSON();

            var newDate = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
            textAchievementsInfo[i]['uploadDate2'] = newDate
            textAchievementsInfo[i]['ID'] = (payload.pageNumber-1)*(payload.pageSize) + 1 + i
            if (evidence.length>0){
              var evidenceString = ""
              for (var m =0;m<evidence.length;m++){
                var num = m + 1
                evidenceString = evidenceString + " \n  " + '(' + num + ')' + '、' + evidence[m]
              }
              textAchievementsInfo[i]['evidence'] = evidenceString
            }
            else{
              textAchievementsInfo[i]['evidence'] = " "
            }

          }
        }
        state.textAchievementsInfosAll = textAchievementsInfo
        state.textAchievementsInfosTotalAll = payload.data.totalCount
      }
      else{
        state.textAchievementsInfosAll = []
        state.textAchievementsInfosTotalAll = 0
      }
    },
    getDivisionTextAchievementsSuccess(state,payload){
      var specificList = ['xls','xlsx','cpg','shp','shx','prj','dbf']
      if (payload.data !== null){
        if (payload.data.hasOwnProperty('result')){
          var textAchievementsInfo =  payload.data.result
          for(var i = 0;i<textAchievementsInfo.length;i++){
            var evidence = []
            textAchievementsInfo[i]['listing'] = " "

            if (textAchievementsInfo[i].hasOwnProperty('files')){
              var files = textAchievementsInfo[i].files
              for (var j =0;j<files.length;j++){
                if (files[j].fileName.indexOf('shp')!==-1){
                  textAchievementsInfo[i]['fileName'] = files[j].fileName
                }
                if (files[j].fileType ==='xls' || files[j].fileType ==='xlsx'){
                  textAchievementsInfo[i]['listing'] = files[j].fileName
                }
                else{
                  textAchievementsInfo[i]['listing'] = textAchievementsInfo[i]['listing'] +  ''
                }
                if (specificList.indexOf(files[j].fileType) === -1){
                  evidence.push(files[j].fileName)
                }

              }
            }
            if (textAchievementsInfo[i].isApproved === 2){
              textAchievementsInfo[i]['isApproved2'] = "人工审核中"
            }
            else if (textAchievementsInfo[i].isApproved === 1){
              textAchievementsInfo[i]['isApproved2'] = "审核完成"
            }
            else {
              textAchievementsInfo[i]['isApproved2'] = "重新上传"
            }
            // if (textAchievementsInfo[i].isApproved === 2){
            //   textAchievementsInfo[i]['isApproved2'] = "人工审核中"
            // }
            if (textAchievementsInfo[i].verifyType === 0){
              textAchievementsInfo[i]['verifyType2'] = "系统审核"
            }
            else {
              textAchievementsInfo[i]['verifyType2'] = "人工审核"
            }
            var date = textAchievementsInfo[i].uploadDate
            var dateee = new Date(date).toJSON();

            var newDate = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
            textAchievementsInfo[i]['uploadDate2'] = newDate
            textAchievementsInfo[i]['ID'] = (payload.pageNumber-1)*(payload.pageSize) + 1 + i
            if (evidence.length>0){
              var evidenceString = ""
              for (var m =0;m<evidence.length;m++){
                var num = m + 1
                evidenceString = evidenceString + " \n  " + '(' + num + ')' + '、' + evidence[m]
              }
              textAchievementsInfo[i]['evidence'] = evidenceString
            }
            else{
              textAchievementsInfo[i]['evidence'] = " "
            }

          }
        }
        state.textAchievementsInfosSuccess = textAchievementsInfo
        state.textAchievementsInfosTotalSuccess = payload.data.totalCount
      }
      else{
        state.textAchievementsInfosSuccess = []
        state.textAchievementsInfosTotalSuccess = 0
      }
    },


    queryAchievementCountAndTime(state,payload){

      if (payload!==null){
        var date = payload.currentDate
        var dateee = new Date(date).toJSON();
        state.currentTime = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
          state.theTotalNumberOfDeclaration = payload.count

      }
      else{
        state.currentTime = ''
        state.theTotalNumberOfDeclaration = 0
      }

      // state.currentTime  = payload.currentDate
    },
    getDivisionCount(state,payload){
      if (payload !== null){
        var data = payload
        const  divisionList = ['第一师','第二师','第三师','第四师','第五师','第六师','第七师','第八师','第九师','第十师','第十一师','第十二师','第十三师','第十四师']
        for (var i=0;i<data.length;i++){

          data[i]['优先'] = data[i]['firstCount']
          data[i]['重点'] = data[i]['secondCount']
          data[i]['一般'] = data[i]['thirdCount']
          data[i]['id'] = divisionList.indexOf(data[i]['city'])
        }
        state.divisionCount = data
      }
      else{
        state.divisionCount = []
      }

      // function sortId(a,b){
      //   return a.id-b.id
      // }
      // data.sort(sortId);
    },
    getDivisionCountContrast(state,payload){
      if (payload.data !== null){
        var data = payload.data
        const  divisionList = payload.conditions
        var newData = []
        for (var i=0;i<data.length;i++){
          if (divisionList.indexOf(data[i]['city'])>-1){
            data[i]['优先'] = data[i]['firstCount']
            data[i]['重点'] = data[i]['secondCount']
            data[i]['一般'] = data[i]['thirdCount']
            newData.push(data[i])
          }
        }
        state.divisionCount = newData
      }
      else{
        state.divisionCount = []
      }

    },
    getDivisionAreaAndCount(state,payload){
      console.log(payload)
      if (payload.length !== 0){
        var data = payload
        for (var i=0;i<data.length;i++){
          if (data[i].hasOwnProperty('county') === false){
            data[i]['county'] = data[i]['city']
            // data.splice(i,1)
            // break
          }
          data[i]['优先'] = data[i]['firstCount']
          data[i]['重点'] = data[i]['secondCount']
          data[i]['一般'] = data[i]['thirdCount']
        }
        var key = data[data.length-1]
        data.unshift(key)
        state.divisionCount = data
      }
      else{
        state.divisionCount = []
      }

    },
    getAreaAndCount(state,payload){
      console.log(payload)
      if (payload !==null){
        var data = payload
        var groupTotalAreas1 = []
        var groupTotalCount1 = []
        groupTotalAreas1.push({value:data.firstArea,name:'优先'})
        groupTotalAreas1.push({value:data.secondArea,name:'重点'})
        groupTotalAreas1.push({value:data.thirdArea,name:'一般'})

        groupTotalCount1.push({value:data.firstCount,name:'优先'})
        groupTotalCount1.push({value:data.secondCount,name:'重点'})
        groupTotalCount1.push({value:data.thirdCount,name:'一般'})

        state.groupTotalAreas = groupTotalAreas1
        state.groupTotalCount = groupTotalCount1
        var areaNumber = 0
        for (var i =0;i<state.groupTotalAreas.length;i++){
          areaNumber = areaNumber +  state.groupTotalAreas[i].value
        }
        var countNumber = 0
        for (var j =0;j<state.groupTotalCount.length;j++){
          countNumber = countNumber +  state.groupTotalCount[j].value
        }
        state.theAllArea = areaNumber
        state.theAllCount = countNumber
      }


    },

    getCurrentCatalogId(state,payload){
        state.currentCatalogId = payload
    },
    getCurrentPageNumber(state,payload){
      state.currentPageNumber = payload
    },

    computedGroup(state,payload){
      if (payload.groupData.length) {
        var AtomsConut = {}
        var HjzldxCount = {}
        var ZylysxCount = {}
        var HjgkdyCount = {}
        for (var i = 0; i < payload.AtomsData.length; i++) {
          if (payload.groupData.indexOf(payload.AtomsData[i]['COUNTY']) > -1) {
            if (AtomsConut.hasOwnProperty(payload.AtomsData[i]['COUNTY'])) {
              AtomsConut[payload.AtomsData[i]['COUNTY']] = AtomsConut[payload.AtomsData[i]['COUNTY']] + 1
            } else {
              AtomsConut[payload.AtomsData[i]['COUNTY']] = 1
            }
          }
          else{
            AtomsConut[payload.AtomsData[i]['COUNTY']] = 0
          }
        }
        for (var j = 0; j < payload.HjzldxData.length; j++) {
          if (payload.groupData.indexOf(payload.HjzldxData[j]['COUNTY']) > -1) {
            if (HjzldxCount.hasOwnProperty(payload.HjzldxData[j]['COUNTY'])) {
              HjzldxCount[payload.HjzldxData[j]['COUNTY']] = HjzldxCount[payload.HjzldxData[j]['COUNTY']] + 1
            } else {
              HjzldxCount[payload.HjzldxData[j]['COUNTY']] = 1
            }
          }
          else{
              HjzldxCount[payload.HjzldxData[j]['COUNTY']] = 0
          }
        }
        for (var m = 0; m < payload.ZylysxData.length; m++) {
          if (payload.groupData.indexOf(payload.ZylysxData[m]['COUNTY']) > -1) {
            if (ZylysxCount.hasOwnProperty(payload.ZylysxData[m]['COUNTY'])) {
              ZylysxCount[payload.ZylysxData[m]['COUNTY']] = ZylysxCount[payload.ZylysxData[m]['COUNTY']] + 1
            } else {
              ZylysxCount[payload.ZylysxData[m]['COUNTY']] = 1
            }
          }
          else{
            ZylysxCount[payload.ZylysxData[m]['COUNTY']] = 0
          }
        }
        for (var n = 0; n < payload.HjgkdyData.length; n++) {
          if (payload.groupData.indexOf(payload.HjgkdyData[n]['COUNTY']) > -1) {
            if (HjgkdyCount.hasOwnProperty(payload.HjgkdyData[n]['COUNTY'])) {
              HjgkdyCount[payload.HjgkdyData[n]['COUNTY']] = HjgkdyCount[payload.HjgkdyData[n]['COUNTY']] + 1
            } else {
              HjgkdyCount[payload.HjgkdyData[n]['COUNTY']] = 1
            }
          }
          else{
              HjgkdyCount[payload.HjgkdyData[n]['COUNTY']] = 0
          }
        }

        var AtomsCounts = []
        var HjzldxCounts = []
        var ZylysxCounts = []
        var HjgkdyCounts = []
        for (var s = 0; s < payload.groupData.length; s++) {
          AtomsCounts.push(AtomsConut[payload.groupData[s]])
          HjzldxCounts.push(HjzldxCount[payload.groupData[s]])
          ZylysxCounts.push(ZylysxCount[payload.groupData[s]])
          HjgkdyCounts.push(HjgkdyCount[payload.groupData[s]])
        }
        state.groupAtomsData = AtomsCounts
        state.groupHjzldxData = HjzldxCounts
        state.groupZylysxData = ZylysxCounts
        state.groupHjgkdyData = HjgkdyCounts
      }
      else{
        state.groupData      =[]
        state.groupAtomsData =[]
        state.groupHjzldxData=[]
        state.groupZylysxData=[]
        state.groupHjgkdyData=[]
      }
    },
    computedCount(state,payload){
      state.figureNumbers = []
      state.figureAreas = []
      state.figureLines = []
      state.groupData = []
      const  keyword  = payload.keyword
      const  statData = payload.data
      const Atoms  = [1,2,3,4]
      const Hjzldx = [5, 6, 7, 8, 26, 27, 28, 29, 9, 10, 11, 12, 30, 31, 32, 33, 13, 14, 15, 16, 17]
      const Zylysx = [18, 19, 34, 35, 36, 37, 20]
      const Hjgkdy = [21, 22, 23, 24]
      var Atomsnumbers  = 0
      var Hjzldxnumbers = 0
      var Zylysxnumbers = 0
      var Hjgkdynumbers = 0
      var AtomsArea  = 0
      var HjzldxArea = 0
      var ZylysxArea = 0
      var HjgkdyArea = 0
      var AtomsLine  = 0
      var HjzldxLine = 0
      var ZylysxLine = 0
      var HjgkdyLine = 0
      var AtomsData  = []
      var HjzldxData = []
      var ZylysxData = []
      var HjgkdyData = []
      if (statData.length){
        for (var i=0;i<statData.length;i++){
          var  vectorData =  eval('('+statData[i].content+')')[0]
          if (vectorData['CITY']===keyword){
            state.groupData.push(vectorData['COUNTY'])
            state.groupData  = Array.from(new Set(state.groupData))
            if (Atoms.indexOf(statData[i].catalogId)>-1){
              Atomsnumbers = Atomsnumbers + 1
              AtomsArea    = AtomsArea + vectorData.SHAPE_Area
              AtomsLine    = AtomsLine + vectorData.SHAPE_Leng
              AtomsData.push(vectorData)
            }
            else if(Hjzldx.indexOf(statData[i].catalogId)>-1){
              Hjzldxnumbers = Hjzldxnumbers +1
              HjzldxArea = HjzldxArea + vectorData.SHAPE_Area
              HjzldxLine = HjzldxLine + vectorData.SHAPE_Leng
              HjzldxData.push(vectorData)
            }
            else if(Zylysx.indexOf(statData[i].catalogId)>-1){
              Zylysxnumbers = Zylysxnumbers +1
              ZylysxArea = ZylysxArea + vectorData.SHAPE_Area
              ZylysxLine = ZylysxLine + vectorData.SHAPE_Leng
              ZylysxData.push(vectorData)
            }
            else if(Hjgkdy.indexOf(statData[i].catalogId)>-1){
              Hjgkdynumbers = Hjgkdynumbers +1
              HjgkdyArea = HjgkdyArea + vectorData.Shape_Area
              HjgkdyLine = HjgkdyLine + vectorData.Shape_Leng
              HjgkdyData.push(vectorData)
            }
          }
        }
        state.figureNumbers=[Atomsnumbers,Hjzldxnumbers,Zylysxnumbers,Hjgkdynumbers]
        state.figureAreas = [AtomsArea,HjzldxArea,ZylysxArea,HjgkdyArea]
        state.figureLines = [AtomsLine,HjzldxLine,ZylysxLine,HjgkdyLine]

      }
      else{
        state.figureNumbers=[0,0,0,0]
        state.figureAreas = [0,0,0,0]
        state.figureLines = [0,0,0,0]
      }
      this.commit('dirmanage/computedGroup',{'groupData':state.groupData,'AtomsData':AtomsData,'HjzldxData':HjzldxData,'HjgkdyData':HjgkdyData,'ZylysxData':ZylysxData})
      // computedGroup(state,)
    },
    computedDivisions(state,payload){
      if (payload.groupData.length) {
        var AtomsConut = {}
        var HjzldxCount = {}
        var ZylysxCount = {}
        var HjgkdyCount = {}
        var AtomsDivisionsArea = {}
        var HjzldxDivisionsArea = {}
        var ZylysxDivisionsArea = {}
        var HjgkdyDivisionsArea = {}
        for (var i = 0; i < payload.AtomsData.length; i++) {
          if (payload.groupData.indexOf(payload.AtomsData[i]['CITY']) !== -1) {
            if (AtomsConut.hasOwnProperty(payload.AtomsData[i]['CITY'])) {
              AtomsConut[payload.AtomsData[i]['CITY']] = AtomsConut[payload.AtomsData[i]['CITY']] + 1
              AtomsDivisionsArea[payload.AtomsData[i]['CITY']] = AtomsDivisionsArea[payload.AtomsData[i]['CITY']] +payload.AtomsData[i]['SHAPE_Area']
            } else {
              AtomsConut[payload.AtomsData[i]['CITY']] = 1
              AtomsDivisionsArea[payload.AtomsData[i]['CITY']] =  payload.AtomsData[i]['SHAPE_Area']
            }
          }
          else {
              AtomsConut[payload.AtomsData[i]['CITY']] = 0
              AtomsDivisionsArea[payload.AtomsData[i]['CITY']] = 0
          }
        }
        for (var j = 0; j < payload.HjzldxData.length; j++) {
          if (payload.groupData.indexOf(payload.HjzldxData[j]['CITY']) > -1) {
            if (HjzldxCount.hasOwnProperty(payload.HjzldxData[j]['CITY'])) {
              HjzldxCount[payload.HjzldxData[j]['CITY']] = HjzldxCount[payload.HjzldxData[j]['CITY']] + 1
              HjzldxDivisionsArea[payload.HjzldxData[j]['CITY']] = HjzldxDivisionsArea[payload.HjzldxData[j]['CITY']] +payload.HjzldxData[j]['SHAPE_Area']
            } else {
              HjzldxCount[payload.HjzldxData[j]['CITY']] = 1
              HjzldxDivisionsArea[payload.HjzldxData[j]['CITY']] =  payload.HjzldxData[j]['SHAPE_Area']
            }
          }
          else{
            HjzldxCount[payload.HjzldxData[j]['CITY']] = 0
            HjzldxDivisionsArea[payload.HjzldxData[j]['CITY']] = 0
          }
        }
        for (var m = 0; m < payload.ZylysxData.length; m++) {
          if (payload.groupData.indexOf(payload.ZylysxData[m]['CITY']) > -1) {
            if (ZylysxCount.hasOwnProperty(payload.ZylysxData[m]['CITY'])) {
              ZylysxCount[payload.ZylysxData[m]['CITY']] = ZylysxCount[payload.ZylysxData[m]['CITY']] + 1
              ZylysxDivisionsArea[payload.ZylysxData[m]['CITY']] = ZylysxDivisionsArea[payload.ZylysxData[m]['CITY']] +payload.ZylysxData[m]['SHAPE_Area']
            } else {
              ZylysxCount[payload.ZylysxData[m]['CITY']] = 1
              ZylysxDivisionsArea[payload.ZylysxData[m]['CITY']] =  payload.ZylysxData[m]['SHAPE_Area']
            }
          }
          else{
            ZylysxCount[payload.ZylysxData[m]['CITY']] = 0
            ZylysxDivisionsArea[payload.ZylysxData[m]['CITY']] = 0
          }
        }
        for (var n = 0; n < payload.HjgkdyData.length; n++) {
          if (payload.groupData.indexOf(payload.HjgkdyData[n]['CITY']) > -1) {
            if (HjgkdyCount.hasOwnProperty(payload.HjgkdyData[n]['CITY'])) {
              HjgkdyCount[payload.HjgkdyData[n]['CITY']] = HjgkdyCount[payload.HjgkdyData[n]['CITY']] + 1
              HjgkdyDivisionsArea[payload.HjgkdyData[n]['CITY']] = HjgkdyDivisionsArea[payload.HjgkdyData[n]['CITY']] +payload.HjgkdyData[n]['Shape_Area']
            } else {
              HjgkdyCount[payload.HjgkdyData[n]['CITY']] = 1
              HjgkdyDivisionsArea[payload.HjgkdyData[n]['CITY']] =  payload.HjgkdyData[n]['Shape_Area']
            }
          }
          else {
              HjgkdyCount[payload.HjgkdyData[n]['CITY']] = 0
              HjgkdyDivisionsArea[payload.HjgkdyData[n]['CITY']] = 0
          }
        }

        var AtomsCounts = []
        var HjzldxCounts = []
        var ZylysxCounts = []
        var HjgkdyCounts = []
        var DivisionsAtomsAreas = []
        var DivisionsHjzldxAreas = []
        var DivisionsZylysxAreas = []
        var DivisionsHjgkdyAreas = []
        for (var s = 0; s < payload.groupData.length; s++) {
          if (AtomsConut[payload.groupData[s]]===undefined){
            AtomsCounts.push(0)
          }
          else{
            AtomsCounts.push(AtomsConut[payload.groupData[s]])
          }
          if(HjzldxCount[payload.groupData[s]]=== undefined){
            HjzldxCounts.push(0)
          }
          else{
            HjzldxCounts.push(HjzldxCount[payload.groupData[s]])
          }
          if (ZylysxCount[payload.groupData[s]] === undefined){
            ZylysxCounts.push(0)
          }
          else{
            ZylysxCounts.push(ZylysxCount[payload.groupData[s]])
          }
          if(HjgkdyCount[payload.groupData[s]] === undefined){
            HjgkdyCounts.push(0)
          }
          else{
            HjgkdyCounts.push(HjgkdyCount[payload.groupData[s]])
          }
          if(AtomsDivisionsArea[payload.groupData[s]] === undefined){
            DivisionsAtomsAreas.push(0)
          }
          else{
            DivisionsAtomsAreas.push(AtomsDivisionsArea[payload.groupData[s]])
          }
          if(HjzldxDivisionsArea[payload.groupData[s]] === undefined){
            DivisionsHjzldxAreas.push(0)
          }
          else {
            DivisionsHjzldxAreas.push(HjzldxDivisionsArea[payload.groupData[s]])
          }
          if(ZylysxDivisionsArea[payload.groupData[s]] === undefined){
            DivisionsZylysxAreas.push(0)
          }
          else{
            DivisionsZylysxAreas.push(ZylysxDivisionsArea[payload.groupData[s]])
          }
          if(HjgkdyDivisionsArea[payload.groupData[s]] === undefined){
             DivisionsHjgkdyAreas.push(0)
          }
          else {
            DivisionsHjgkdyAreas.push(HjgkdyDivisionsArea[payload.groupData[s]])
          }
        }
        state.groupAtomsData = AtomsCounts
        state.groupHjzldxData = HjzldxCounts
        state.groupZylysxData = ZylysxCounts
        state.groupHjgkdyData = HjgkdyCounts
        state.DivisionsAtomsAreaList = DivisionsAtomsAreas
        state.DivisionsHjzldxAreaList = DivisionsHjzldxAreas
        state.DivisionsZylysxAreaList = DivisionsZylysxAreas
        state.DivisionsHjgkdyAreaList = DivisionsHjgkdyAreas
      }
      else{
        state.groupData      =[]
        state.groupAtomsData =[]
        state.groupHjzldxData=[]
        state.groupZylysxData=[]
        state.groupHjgkdyData=[]
      }
    },
    computedCountTo(state,payload){
      state.divisionsFigureNumbers = []
      state.divisionsFigureAreas = []
      state.divisionsFigureLines = []
      const  keyword  = payload.keyword
      const  statData = payload.data
      const Atoms  = [1,2,3,4]
      const Hjzldx = [5, 6, 7, 8, 26, 27, 28, 29, 9, 10, 11, 12, 30, 31, 32, 33, 13, 14, 15, 16, 17]
      const Zylysx = [18, 19, 34, 35, 36, 37, 20]
      const Hjgkdy = [21, 22, 23, 24]
      var Atomsnumbers  = 0
      var Hjzldxnumbers = 0
      var Zylysxnumbers = 0
      var Hjgkdynumbers = 0
      var AtomsArea  = 0
      var HjzldxArea = 0
      var ZylysxArea = 0
      var HjgkdyArea = 0
      var AtomsLine  = 0
      var HjzldxLine = 0
      var ZylysxLine = 0
      var HjgkdyLine = 0
      var AtomsData  = []
      var HjzldxData = []
      var ZylysxData = []
      var HjgkdyData = []
      if (statData.length){
        for (var i=0;i<statData.length;i++){
            var  vectorData =  eval('('+statData[i].content+')')[0]
            if (Atoms.indexOf(statData[i].catalogId)>-1){
              Atomsnumbers = Atomsnumbers + 1
              AtomsArea    = AtomsArea + vectorData.SHAPE_Area
              AtomsLine    = AtomsLine + vectorData.SHAPE_Leng
              AtomsData.push(vectorData)
            }
            else if(Hjzldx.indexOf(statData[i].catalogId)>-1){
              Hjzldxnumbers = Hjzldxnumbers +1
              HjzldxArea = HjzldxArea + vectorData.SHAPE_Area
              HjzldxLine = HjzldxLine + vectorData.SHAPE_Leng
              HjzldxData.push(vectorData)
            }
            else if(Zylysx.indexOf(statData[i].catalogId)>-1){
              Zylysxnumbers = Zylysxnumbers +1
              ZylysxArea = ZylysxArea + vectorData.SHAPE_Area
              ZylysxLine = ZylysxLine + vectorData.SHAPE_Leng
              ZylysxData.push(vectorData)
            }
            else if(Hjgkdy.indexOf(statData[i].catalogId)>-1){
              Hjgkdynumbers = Hjgkdynumbers +1
              HjgkdyArea = HjgkdyArea + vectorData.Shape_Area
              HjgkdyLine = HjgkdyLine + vectorData.Shape_Leng
              HjgkdyData.push(vectorData)
            }
          }
        state.divisionsFigureNumbers=[Atomsnumbers,Hjzldxnumbers,Zylysxnumbers,Hjgkdynumbers]
        state.divisionsFigureAreas = [AtomsArea,HjzldxArea,ZylysxArea,HjgkdyArea]
        state.divisionsFigureLines = [AtomsLine,HjzldxLine,ZylysxLine,HjgkdyLine]
        }
      else{
        state.divisionsFigureNumbers=[0,0,0,0]
        state.divisionsFigureAreas = [0,0,0,0]
        state.divisionsFigureLines = [0,0,0,0]
      }

      this.commit('dirmanage/computedDivisions',{'groupData':keyword,'AtomsData':AtomsData,'HjzldxData':HjzldxData,'HjgkdyData':HjgkdyData,'ZylysxData':ZylysxData})
      // computedGroup(state,)
    },
    getbackUpConfigMes(state,payload){
       state.backUpConfigMes = payload.message
    },
    getBackupconfig(state, payload) {
        if (payload.data!==null){
          state.backupRecoveryList = []
          for (var i=0;i<payload.data.result.length;i++){
            payload.data.result[i].backUpConfig['currentTime'] =payload.data.result[i].handleDateTime.split('T')[0]
            payload.data.result[i].backUpConfig['exception'] = payload.data.result[i].exception
            // console.log(payload[i].filePath.split('/').slice(-1)[0].split('.')[0].split('_')[0] + " " + payload[i].filePath.split('/').slice(-1)[0].split('.')[0].split('_').slice(-1)[0].replaceAll('-',':'))
            payload.data.result[i].backUpConfig['IDs'] = payload.data.result[i].id

            payload.data.result[i].backUpConfig['ID'] = i + 1 + (payload.pageNumber -1)*payload.pageSize
            if (payload.data.result[i].backUpConfig.backUpMode ===0){
              payload.data.result[i].backUpConfig['Mode'] = '按库备份'
            }
            else{
              payload.data.result[i].backUpConfig['Mode'] = '按表备份'
            }
            if(payload.data.result[i].backUpConfig.backUpCycle ===0){
              payload.data.result[i].backUpConfig['Cycle'] = '年/次'
            }
            else if(payload.data.result[i].backUpConfig.backUpCycle ===1){
              payload.data.result[i].backUpConfig['Cycle'] = '月/次'
            }
            else if( payload.data.result[i].backUpConfig.backUpCycle ===2){
              payload.data.result[i].backUpConfig['Cycle'] = '日/次'
            }
            else{
              payload.data.result[i].backUpConfig['Cycle'] = '周/次'
            }
            if(payload.data.result[i].backUpConfig.selectTableName !=='' ){
              payload.data.result[i].backUpConfig['TableName'] = payload.data.result[i].backUpConfig.selectTableName
            }
            else{
              payload.data.result[i].backUpConfig['TableName'] = payload.data.result[i].backUpConfig.selectDBName
            }
            payload.data.result[i].backUpConfig['runMethod'] = '定时备份'
            state.backupRecoveryList.push(payload.data.result[i].backUpConfig)
          }
          state.backupConfigTotalCounts = payload.data.totalCount
        }
       else {
          state.backupRecoveryList = []
        }

    },
    getDbaseNameList(state,payload){
      state.dbasenamelist = []
      if (payload!==null){
        // for (var i=0;i<payload.length;i++){
        //   state.dbasenamelist.push(payload[i].name)
        // }
        state.dbasenamelist = payload
      }
      else{
        state.dbasenamelist = []
      }

    },
    getTableNameList(state,payload){
      state.dbtablenamelist = []
      if (payload!==null){
        state.dbtablenamelist= payload
        state.dbtablenamelistObj = payload
      }
      else{
        state.dbtablenamelist= payload
        state.dbtablenamelistObj = payload
      }
      // for (var i=0;i<payload.length;i++){
      //   state.dbtablenamelist.push(payload[i].name)
      // }

    },
    getBackupListTable(state, payload) {
      if (payload.data!==null){
        var backlistlist =  payload.data.result
        state.backupListTotal = payload.data.totalCount
        for (var i=0;i<backlistlist.length;i++){
          if (backlistlist[i].backUpMode===0){
            backlistlist[i].Mode = '数据库备份'
          }
          else{
            backlistlist[i].Mode = '数据表备份'
          }
          if(backlistlist[i].backUpCycle===0){
            backlistlist[i].Cycle = '年/次'
          }
          else if(backlistlist[i].backUpCycle===1){
            backlistlist[i].Cycle = '月/次'
          }
          else if(backlistlist[i].backUpCycle===2){
            backlistlist[i].Cycle = '日/次'
          }
          else{
            backlistlist[i].Cycle = '周/次'
          }
          backlistlist[i]['ID'] = i + 1 + (payload.pageNumber-1)*payload.pageSize
        }
        state.backupList = backlistlist
      }
      else{
        state.backupList = []
      }
    },
    changeTable(state,payload){
      state.dataType = payload
    },
    getCatalogList(state,payload){
        state.catalogList = payload
    },
    resetVectorBreadCrumbs(state,payload){
       state.resetVectorBreadCrumbsList = []
       state.resetVectorBreadCrumbsList = payload
       state.xlsname = ''
       state.xlsname = state.resetVectorBreadCrumbsList.join('_') + '.xls'
    },
    resetTextBreadCrumbs(state,payload){
       state.resetTextBreadCrumbsList = []
       state.resetTextBreadCrumbsList = payload
       // state.Txtxlsname = ''
       // state.Txtxlsname = state.resetVectorBreadCrumbsList.join('_') + '.xls'
    },
    getCurrentLink(state,payload){
       state.currentLink = payload
    },
    getVectorFindKeys(state,payload){
        state.vectorDataFindKeys = []
        state.vectorDataFindKeys = payload
        state.theVectorData = []
        if (state.dataType){
          for (var i=0;i< state.oldVectorData.length;i++){
            var HJYSGKFQBM =  state.oldVectorData [i]['HJYSGKFQBM']
            var HJYSGKFQMC =  state.oldVectorData [i]['HJYSGKFQMC']
            var LXBM       =  state.oldVectorData [i]['LXBM']
            if (HJYSGKFQBM.indexOf(payload[0]) > -1 && HJYSGKFQMC.indexOf(payload[1]) > -1 && LXBM.indexOf(payload[2])>-1){
              state.theVectorData.push(state.oldVectorData[i])
            }
          }
        }
        else{
          for (var j=0;j< state.oldVectorData.length;j++){
            var HJGKDYBM =  state.oldVectorData [j]['HJGKDYBM']
            var HJGKDYMC =  state.oldVectorData [j]['HJGKDYMC']
            var GKDYFL   =  state.oldVectorData [j]['GKDYFL']
            if (HJGKDYBM.indexOf(payload[0]) > -1 && HJGKDYMC.indexOf(payload[1]) > -1 && GKDYFL.indexOf(payload[2])>-1){
              state.theVectorData.push(state.oldVectorData[j])
            }
          }
        }

    },
    resetVectorData(state,payload){
      state.theVectorData = []
      state.theVectorData = state.oldVectorData
    },
    updateDirStore(state,payload){
      Vue.set(state,'datalist',payload)
    },
    editDirStore(state,payload){
      // var data = JSON.stringify(payload)
      // data = data.replaceAll('"children":[]','')
      // state.catalogListSelect = eval('('+data+')')
    },
    updateLoading(state,payload){
      state.loading = payload
    },
    addDatalist(state,payload){
      state.datalist.push(payload)
      state.newCatlog = payload.parent
    },
    addChildData(state,payload){
      state.newCatlog = payload.parent
    },
    editCatlogName(state,payload){
      state.updateDataList = payload.data
      state.updateDataList.parent.catalogName = payload.newName
      state.updateDataList = state.updateDataList.parent
    },
    getDocumentList(state,payload){
       state.documentIdList.push(payload.catalogName)
    },

    getVectorData(state,payload) {
      state.theVectorData = []
      if (payload.length){
         for (var i=0;i<payload.length;i++){
              var  vectorData =  eval('('+payload[i].content+')')[0]
              // var vectorData = JSON.parse(payload[i].content)[0]
              vectorData['id'] = i + 1
              if (vectorData.hasOwnProperty('HJYSGKFQBM')){
                vectorData['LXBM'] = vectorData['HJYSGKFQBM'].substr(8,3)
              }
              else if(vectorData.hasOwnProperty('HJGKDYBM')){
                vectorData['LXBM'] = vectorData['HJGKDYBM'].substr(8,9)
              }
              // vectorData['YSXL'] = vectorData['YSXL'].replace("\r\n","◎").split('◎')[0]
              vectorData['District'] =  vectorData['CITY'] + vectorData['COUNTY']
              state.theVectorData.push(vectorData)
         }
        state.oldVectorData = state.theVectorData
        state.theVectorDataTotal = payload.length
      }
      else{
        state.theVectorData = []
        state.theVectorDataTotal = 0
      }
    },
    getAttributeVectorDataInfo(state,payload){
      state.theVectorData = []
      if (payload.data !==null){
        if (payload.data.hasOwnProperty('result')){

          for(var i=0;i<payload.data.result.length;i++){
            var  vectorData =  payload.data.result[i]
            vectorData['ID'] = i + 1 + (payload.pageNumber-1)*(payload.pageSize)
            vectorData['lxbm'] = vectorData['hjdybm'].substr(8,3)
            vectorData['district'] = vectorData['city'] + vectorData['county']
            state.theVectorData.push(vectorData)
          }
          state.theVectorDataTotal = payload.data.totalCount
        }
        else{
          state.theVectorData = []
          state.theVectorDataTotal = 0
        }
      }
      else{
        state.theVectorData = []
        state.theVectorDataTotal = 0
      }
    },
    getAttributeDYVectorDataInfo(state,payload){
      state.theDYVectorData = []
      if (payload.data !==null){
        if (payload.data.hasOwnProperty('result')){
          for(var i=0;i<payload.data.result.length;i++){
            var  vectorData =  payload.data.result[i]
            vectorData['ID'] = i + 1 + (payload.pageNumber-1)*(payload.pageSize)
            vectorData['lxbm'] = vectorData['hjdybm'].substr(8,3)
            vectorData['district'] = vectorData['city'] + vectorData['county']
            state.theDYVectorData.push(vectorData)
          }
          state.theDYVectorDataTotal = payload.data.totalCount
        }
        else{
          state.theDYVectorData = []
          state.theDYVectorDataTotal = 0
        }
      }
      else{
        state.theDYVectorData = []
        state.theDYVectorDataTotal = 0
      }
    },
    getOnTimeBackupSingleText(state,payload){
      state.ontimeBackupSingleText = payload.message
    }
  },
  actions: {
// 根据用户确定是师还是兵团来获取区划信息
    getfindAllByDivision(context){
      axios({
        url:'/back/v1.0/unit/find/city/findAllByDivision',
        type:'get',
      }).then((response)=>{
        context.commit("getCityByDivision",response.data.data)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 获取目录树
    getCatlog(context){
      axios({
        url:'/api/v1.0/resultIntegration/catalog/findAll',
        type:'get',
      }).then((response)=>{
        context.commit("updateDirStore",response.data.data)
        // context.commit('editDirStore',response.data.data)
        context.commit("updateLoading",false)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 获取目录列表
    getCatlogData(context){
      axios({
        url:'/api/v1.0/resultIntegration/catalog/findAll1',
        type:'get',
      }).then((response)=>{
        context.commit('getCatalogList',response.data.data)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 修改目录名称
    updateCatlog(context){
      axios.put( '/api/v1.0/resultIntegration/catalog/update',
        context.state.updateDataList
      ).then((response)=>{
        context.dispatch('getCatlog')
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 新增目录
    addRootCatalog(context){
      axios({
        url:'/api/v1.0/resultIntegration/catalog/save',
        method:'post',
        data:context.state.newCatlog,
      }).then((response)=>{
          context.dispatch('getCatlog')
        }).catch((error)=>{
        console.log(error)
      })
    },
    // 通过目录ID删除目录
    deleteCatlog(context,id){
      axios({
        url:'/api/v1.0/resultIntegration/catalog/delete/' + id,
        method:'delete',
      }).then((response)=>{
          context.dispatch('getCatlog')
        }).catch((error)=>{
        console.log(error)
      })
    },
    // 通过目录id和数据类型id查询数据
    getDataCiAi(context,catalog){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/findAllByCatalogIdAndAchievementsTypeIds',
        // params:catalog,
        data:catalog,
        method:'post',
      }).then((response)=>{
          context.commit('getVectorData',response.data.data)

          // context.commit()
        })
        // .catch((error)=>{
        // console.log(error)
      // })
    },
    async getDataCiAiTo(context,catalog){
      await  axios({
        url:'/api/v1.0/resultIntegration/achievements/findAll',
        // params:catalog,
        // data:catalog[0],
        method:'get',
      }).then((response)=>{
        if (catalog.keyword.length ===3 || catalog.keyword.length ===4){
          context.commit('computedCount',{'data':response.data.data,'keyword':catalog.keyword})
        }
        else {
          context.commit('computedCountTo',{'data':response.data.data,'keyword':catalog.keyword})
        }

      })
      // .catch((error)=>{
      // console.log(error)
      // })
    },
    // 面包屑数据 通过获取到的目录code数组进行查询
    getDocument(context,code){
     axios({
       url:'/api/v1.0/resultIntegration/findByCode/' + code,
       method:'get',
     }).then((response)=>{
         context.commit('getDocumentList',response.data.data)
         // return response.data.data
       }).catch((error)=>{
       console.log(error)
     })
   },
    // 新增备份配置
    postBackupTable(context,payload){
      axios({
        url:'/bup/v1.0/backUpConfig/save',
        // params:catalog,
        data:payload.formobj,
        method:'post',
      }).then((response)=>{
        context.dispatch('getBackupList',payload.pageObj)
      })
      .catch((error)=>{
      console.log(error)
      })
    },
    // 获取备份列表
    getBackupList(context,payload){
      axios({
      // /database-handle-server
        url:'/bup/v1.0/backUpConfig/findPages?pageNumber='+ payload.pageNumber + '&pageSize='+  payload.pageSize +
          '&configName=' + payload.configName + '&configMode=' + payload.configMode  + '&configCycle=' + payload.configCycle,
        method:'get',
      }).then((response)=>{
        // context.state.backupListTotal = response.data.data.totalCount
        context.commit('getBackupListTable', {data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
        // return response.data.data
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 删除备份列表
    deleteBackupList(context,payload){
      axios({
        url:'/bup/v1.0/backUpConfig/delete/' + payload.deleteId,
        method:'delete',
      }).then((response)=>{
        var pageObj={
          pageNumber:1,
          pageSize:15
        }
        // context.commit('getBackupListTable',response.data.data.result)
        // return response.data.data
        context.dispatch('getBackupList',payload.pageObj)
      }).catch((error)=>{
        console.log(error)
      })
    },

    // 更新备份列表
    updateBackupList(context,payload){
      axios({
        url:'/bup/v1.0/backUpConfig/update',
        data:payload.updateformobj,
        method:'put',
      }).then((response)=>{
        context.dispatch('getBackupList',payload.pageObj)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 启动备份
     async startBackupList(context,startId){
       await axios({
        url:'/bup/v1.0/backUpConfig/startOnce/'+ startId,
        method:'get',
        }).then((response)=>{
        context.commit('getOnTimeBackupSingleText',response.data)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 是否启动备份设置
     isSetBackup(context,payload){
       axios({
        url:'/bup/v1.0/backUpConfig/updateStartStatus/'+payload.Id+'/'+ payload.isStartedId,
        method:'get',
      }).then((response)=>{
        // context.commit('getOnTimeBackupSingleText',response.data)
         context.dispatch('getBackupList',payload.pageObj)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 查询数据库字典基础数据 -- 数据库
    getDbaseName(context){
      axios({
        url:'/bup/v1.0/backUpConfig/findPages/findAllByIsDB/1',
        method:'get',
      }).then((response)=>{
        context.commit('getDbaseNameList',response.data.data)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 查询数据库字典基础数据 -- 数据库
    getTableName(context){
      //
      axios({
        url:'/bup/v1.0/backUpConfig/findPages/findAllByIsDB/0',
        method:'get',
      }).then((response)=>{

        context.commit('getTableNameList',response.data.data)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // GET /api/v1.0/backUpConfig/result/findPages
    // 分页查询备份配置定时执行结果信息
    getBackUpConfig(context,payload){
      //
      axios({
      // /database-handle-server
        url:'/bup/v1.0/backUpConfig/result/findPages?pageNumber='+ payload.pageNumber + '&pageSize=' + payload.pageSize+
          '&configName=' + payload.configName + '&configMode=' + payload.configMode  + '&configCycle=' + payload.configCycle,
        method:'get',
      }).then((response)=>{
        context.commit('getBackupconfig', {data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 备份恢复
    async getBackUpResume(context,payload){
      //
     await axios({
        url:'/bup/v1.0/backUpConfig/result/resume/' + payload.id,
        method:'get',
      }).then((response)=>{
        context.commit('getbackUpConfigMes',response.data)
      }).catch((error)=>{
        console.log(error)
      })
    },
    // 删除备份恢复的数据
    deleteBackupRecoveryList(context,payload){
      axios({
        url:'/bup/v1.0/backUpConfig/result/delete/' + payload.deleteId,
        method:'delete',
      }).then((response)=>{
        var pageObj={
          pageNumber:1,
          pageSize:15
        }
        context.dispatch('getBackUpConfig',payload.pageObj)
      }).catch((error)=>{
        console.log(error)
      })
    },

    // 上传文本成果
    uploadTextTable(context,payload){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/text/upload',
        // params:catalog,
        data:payload,
        method:'post',
      }).then((response)=>{
        // var pageObj={
        //   pageNumber:1,
        //   pageSize:15
        // }
        // context.dispatch('getBackupList',payload.pageObj)
        // console.log(response)
      })
        .catch((error)=>{
          console.log(error)
        })
    },
    // 分页查询成果管控清单
    // /api/v1.0/resultIntegration/achievements/text/findPages
    getTextData(context,payload){
       var parm = {
                pageNumber:1,
                pageSize:0,
                code:'',
                city:'',
                county:'',
              }
       var cityName = ''
       if (payload.city ==='新疆生产建设兵团'){
         cityName = ''
       }
       else{
         cityName = payload.city
       }
       parm.city = cityName;
       var aurl='/api/v1.0/resultIntegration/achievements/text/findPages?pageNumber='+payload.pageNumber
         +'&pageSize=' + payload.pageSize + '&code=' + payload.code + '&city=' + cityName + '&county=' + payload.county;
       if(cityName==''){
         aurl='/api/v1.0/resultIntegration/achievements/text/findPages?pageNumber='+payload.pageNumber
           +'&pageSize=' + payload.pageSize + '&code=' + payload.code +  '&county=' + payload.county
       }
       else if( payload.county==''){
         aurl='/api/v1.0/resultIntegration/achievements/text/findPages?pageNumber='+payload.pageNumber
           +'&pageSize=' + payload.pageSize + '&code=' + payload.code + '&city=' + cityName
       }else  if(cityName=='' && payload.county==''){
         aurl='/api/v1.0/resultIntegration/achievements/text/findPages?pageNumber='+payload.pageNumber
           +'&pageSize=' + payload.pageSize + '&code=' + payload.code
       }
       axios({
        url:aurl,
        method:'get',
      }).then((response)=>{
         parm.code = payload.code
         parm.county = payload.county
         if(response.data.data!==null){
           parm.pageSize = response.data.data.totalCount
         }
         else{
           parm.pageSize = 0
         }
         context.commit('getTextDataInfo',{data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
         // context.dispatch('downloadTextXls',parm)
      }).catch((error)=>{
        console.log(error)
      })
    },

    downloadTextXls(context,payload){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/text/findPages?pageNumber='+payload.pageNumber
          +'&pageSize=' + payload.pageSize + '&code=' + payload.code + '&city=' + payload.city + '&county=' + payload.county,
        method:'get',
      }).then((response)=>{
        context.commit('getDownloadTextDataInfo',response.data.data)
      }).catch((error)=>{
        console.log(error)
      })
    },


    //  分页查询 矢量数据的  属性信息
    getAttributeInfo(context,payload){
      var cityName = ''
      if (payload.name ==='新疆生产建设兵团'){
        cityName = ""
      }
      else{
        cityName = payload.name
      }
      axios({
        url:'/api/v1.0/resultIntegration/environmentAttribute/findPages?pageNumber='+payload.pageNumber
          +'&pageSize=' + payload.pageSize + '&code=' + payload.code + '&cityName=' + cityName + '&catalogId=' + payload.catalogId,
        // params:catalog,
        method:'get',
      }).then((response)=>{
        var parm = {
          pageNumber:1,
          pageSize:0,
          code:'',
          name:'',
          catalogId:'',
        }
        parm.code = payload.code
        parm.name = cityName
        parm.catalogId = payload.catalogId
        if (response.data.data!== null){
          // payload.pageSize = response.data.data.totalCount
          parm.pageSize = response.data.data.totalCount
        }
        else{
          parm.pageSize = 0
        }
        if (payload.catalogId>20 && payload.catalogId<25){
          context.commit('getAttributeDYVectorDataInfo', {data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})

        }
        else{
          context.commit('getAttributeVectorDataInfo', {data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
        }
        // context.dispatch('downloadXls',parm)
      })
    },
    downloadXls(context,payload){
      // this.$store.dispatch('dirmanage/getAttributeInfo',requestKey)
      axios({
        url:'/api/v1.0/resultIntegration/environmentAttribute/findPages?pageNumber='+payload.pageNumber
          +'&pageSize=' + payload.pageSize + '&code=' + payload.code + '&cityName=' + payload.name + '&catalogId=' + payload.catalogId,
        // params:catalog,
        method:'get',
      }).then((response)=>{

        context.commit('downloadXlsData',response.data.data)
      })
      // this.$http.get('/v1.0/resultIntegration/environmentAttribute/findPages?pageNumber='+this.requestKey.pageNumber2 + '&pageSize='  +
      //   this.requestKey.pageSize2 + '&code=' + this.requestKey.code2 + '&cityName=' + this.requestKey.name2 + '&catalogId=' + this.requestKey.catalogId2).then((response)=>{
      //   if (response.data.status==='3000'){
      //     console.log(response.data.data.result)
      //     this.downloadYSVectorData = response.data.data.result
      //   }
      //   else{
      //     this.$message.error('文件下载失败！')
      //   }
      // })
    },
    // 分页查询 成果清单信息
    getAttributeTextInfo(context,payload){
      axios({
        url:'api/v1.0/resultIntegration/achievements/text/findPages?pageNumber='+payload.pageNumber  +'&pageSize=' + payload.pageSize + '&code=' + payload.code + '&city=' + payload.city + '&county=' + payload.county,
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('getAttributeTextDataInfo',response.data.data)
        // context.commit()
      })
      // .catch((error)=>{
      // console.log(error)
      // })
    },
    // 查询所有矢量文件类型字典表
    // "GET /api/v1.0/resultIntegration/achievements/VectorFileCategory/findAll"
    getVectorFileCategory(context,payload){
      axios({
        //   /api/v1.0/resultIntegration/achievements/achievementsUniversal/verified/findAll
        url:'/api/v1.0/resultIntegration/achievements/achievementsUniversal/verified/findAll',
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('getVectorFileCategoryList',response.data.data)
      })
    },

    //  统计查询环境管控单元数量及面积
    async  getUnitAreaAndCount(context,payload){
    await  axios({
        url:'/api/v1.0/resultIntegration/statics/queryUnitAreaAndCount',
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('getAreaAndCount',response.data.data)
      })
    },

    //统计各个师查询环境管控单元数量
    async  getDivisionUnitCount(context,payload){
      await  axios({
        url:'/api/v1.0/resultIntegration/statics/queryCityUnitCount',
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('getDivisionCount',response.data.data)
      })
    },
    // 更新佐证材料
    updateEvidenceFiles(context,payload){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/temp/fileTemp/updateEvidenceFiles/' + payload.achievementTempId,
        // params:catalog,
        data:payload.data,
        method:'put',
      }).then((response)=>{
        console.log(response)
      })
    },
    //  师级系统审核接口-更新矢量文件
    // POST /api/v1.0/resultIntegration/achievements/temp/update
    // updateVectorFile(context,payload){
    //   axios({
    //     url:'/api/v1.0/resultIntegration/achievements/temp/update',
    //     // params:catalog,
    //     method:'post',
    //   }).then((response)=>{
    //     console.log(response.data.data)
    //   })
    // },

    // 人工审核接口
    manualVerify(context,payload){
      console.log(payload)
      axios({
        // 师级人工审核接口
        // url:'/api/v1.0/resultIntegration/achievements/temp/verify/manualVerify/'+ payload.isApproved +'/'+payload.verifyContent + '/'+payload.achievementTempId,
        // 通用人工审核接口
        // /api/v1.0/resultIntegration/achievements/achievementsUniversal/verify/manualVerify/{isApproved}/{verifyContent}/{achievementId}
        url:'/api/v1.0/resultIntegration/achievements/achievementsUniversal/verify/manualVerify/'+ payload.isApproved +'/'+payload.verifyContent + '/'+payload.achievementTempId,
        // data:payload,
        method:'post',
      }).then((response)=>{
        console.log(response)
      })
    },
    // 压缩某师的成果文件
    //"GET /api/v1.0/resultIntegration/achievements/temp/fileTemp/zipFileByCityId/{cityId}"
    getZipFileByCityId(context,payload){
       axios({
        url:'/api/v1.0/resultIntegration/achievements/temp/fileTemp/zipFileByCityId/'+payload.id,
        method:'get',
      }).then((response)=>{
        console.log(response)
      })
    },
    // 压缩某类型的成果文件
    // /api/v1.0/resultIntegration/achievements/temp/fileTemp/zipFileCategory/{fileCategoryId}
    getZipFileCategoryId(context,payload){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/temp/fileTemp/zipFileCategory/'+payload.id,
        method:'get',
      }).then((response)=>{
         console.log(response)
      })
    },
    //分页查询师级审核成果数据 /api/v1.0/resultIntegration/achievements/temp/report/findPages?pageNumber
    //  通用     GET /api/v1.0/resultIntegration/achievements/achievementsUniversal/report/findPages
    getDivisionAchievements(context,payload){
        axios({
        url:'/api/v1.0/resultIntegration/achievements/achievementsUniversal/report/findPages?pageNumber='+payload.pageNumber + "&pageSize="+payload.pageSize+'&isApproved='+payload.isApproved,
        // params:catalog,
        method:'get',
      }).then((response)=>{
            context.commit('getDivisionTextAchievementsAll',{data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
      })
    },
    getDivisionAchievementsVerifying(context,payload){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/achievementsUniversal/verifying/findPages?pageNumber='+payload.pageNumber +
          "&pageSize="+payload.pageSize+'&isApproved='+payload.isApproved,
        // params:catalog,
        method:'get',
      }).then((response)=>{
          context.commit('getDivisionTextAchievements',{data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
      })
    },
    getDivisionAchievementsVerified(context,payload){
      axios({
        url:'/api/v1.0/resultIntegration/achievements/achievementsUniversal/verified/findPages?pageNumber='+payload.pageNumber + "&pageSize="+payload.pageSize+'&isApproved='+payload.isApproved,
        // params:catalog,
        method:'get',
      }).then((response)=>{
          context.commit('getDivisionTextAchievementsSuccess',{data:response.data.data,pageNumber:payload.pageNumber,pageSize:payload.pageSize})
      })
    },


    // 统计师环境管控单元面积和数量
    async  getDivisionUnitAreaAndCount(context,payload){
      await  axios({
        url:'/api/v1.0/resultIntegration/statics/queryCityUnitAreaAndCount/'+payload.city,
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('getAreaAndCount',response.data.data)
      })
    },

    //
    async  getGroupUnitAreaAndCount(context,payload){
      await  axios({
        url:'/api/v1.0/resultIntegration/statics/queryCountyUnitCount/'+payload.city,
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('getDivisionAreaAndCount',response.data.data)
      })
    },
    //  统计成果申报总数及最近填报时间
    getAchievementCountAndTime(context,payload){
     axios({
        url:'/api/v1.0/resultIntegration/statics/queryAchievementCountAndTime?cityId='+ payload.id,
        // params:catalog,
        method:'get',
      }).then((response)=>{
        context.commit('queryAchievementCountAndTime',response.data.data)
      })
    },
  },
}
